/**
 * Copyright (c) qzsoft All rights reserved.
 *
 * qzsoft.cn
 *
 * 版权所有，侵权必究！
 */

package com.qzsoft.system.repository.sys.dao;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qzsoft.system.modules.permission.role.dto.SysRoleDTO;
import com.qzsoft.system.modules.permission.roleclass.dto.SysRoleClassTreeDTO;
import com.qzsoft.system.repository.sys.entity.SysRoleEntity;
import com.qzsoft.jeemis.common.dao.BaseDao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 角色管理
 *
 */
@Mapper
public interface SysRoleDao extends BaseDao<SysRoleEntity> {

    List<SysRoleDTO> selectRoleList(@Param("param") Map<String, Object> params);

    IPage<SysRoleDTO> selectRoleListPage(IPage page, @Param("param") SysRoleDTO dto);

    IPage<SysRoleDTO> selectGroupRoleListPage(IPage page, @Param("param") SysRoleDTO dto);

    List<SysRoleClassTreeDTO> selectGroupRoleList();

    @Select("SELECT * FROM sys_role where dept_id=#{deptId} and has_default=1 and has_delete=0")
    SysRoleDTO getDeptDefaultRole(String deptId);

    @Select("SELECT * FROM sys_role where  has_default=1 and has_delete=0 and type=0")
    List<Long> selectCommonDefaultRoleIds();
}
